<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function fn1(n){
            var sum = 0;
            for(var i=1 ; i<n;i++){
                if(n%i==0){
                    sum = sum+i;
                }
            }
            return sum;
        }
        function fn2(a,b){
            for(var i=a ; i<=b ;i++){
                 if(i == fn1(i)){
                     document.write(i +'<br>');
                 }
            }
        }
        var i = Number(prompt("请输入开始数"));
        var j = Number(prompt("请输入结束数"));
        fn2(i,j);
    </script>
</body>
</html>